package cate.game.pvp.guildwar.data.msg;

import cate.game.pvp.guildwar.data.GuildWar;
import cate.game.pvp.guildwar.data.GuildWarLog;
import cate.game.pvp.guildwar.data.GuildWarPt;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.HashMap;
import java.util.Map;

@NoteClass("公会战-一方数据的更新")
public class GWSideInnerUpdate {

	@NoteField("目标区服id")
	public int tarSrvId;

	@NoteField("目标公会的唯一ID")
	public String tarGuildUid;

	@NoteField(value = "据点数据",detail = "只有第一次会发,如果为null说明只更新了一个据点")
	public Map<Integer, GuildWarPt> ptMap = new HashMap<>();

	@NoteField("单个据点的更新")
	public GWPtInnerUpdate pt;

	@NoteField(value = "本次新增的日志",detail = "如果为null说明没有更新")
	public GuildWarLog log;

	public static GWSideInnerUpdate of(GuildWar war){
		GWSideInnerUpdate data = new GWSideInnerUpdate();
		data.tarSrvId = war.field.b.profile.srvId;
		data.tarGuildUid = war.field.b.profile.uid;
		data.ptMap = war.field.b.ptMap;
		return data;
	}

	public static GWSideInnerUpdate of(GuildWar war, GWPtInnerUpdate pt, GuildWarLog log) {
		GWSideInnerUpdate data = new GWSideInnerUpdate();
		data.tarSrvId = war.field.b.profile.srvId;
		data.tarGuildUid = war.field.b.profile.uid;
		data.pt = pt;
		data.log = log;
		return data;
	}
}
